﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:IC="clr-namespace:Silverlight.InputCtrl;assembly=Silverlight.InputCtrl"         
    mc:Ignorable="d" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns:layoutPrimitivesToolkit="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Layout.Toolkit" x:Class="MaskedEditDemo.MainPage"
    xmlns:local="clr-namespace:MaskedEditDemo"
    Height="800" Width="540" >
    <UserControl.Resources>
        <local:MaskEditConvertNumbers x:Key="MaskEditConv" />
    </UserControl.Resources>
	<Grid x:Name="LayoutRoot" Background="#FFFCFCFC" Margin="0">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="260"/>
			<ColumnDefinition Width="5"/>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="72" />
			<RowDefinition Height="72"/>
			<RowDefinition Height="72"/>
			<RowDefinition Height="72"/>
			<RowDefinition Height="72"/>
			<RowDefinition Height="72"/>
			<RowDefinition Height="144"/>
			<RowDefinition Height="*"  />
		</Grid.RowDefinitions>
		<TextBlock Text="Result in TextUnMasked  Property" TextWrapping="Wrap" FontWeight="Bold" Foreground="#FF0F7A01" FontSize="12" Margin="0,0,-10,0" Grid.ColumnSpan="2" Grid.Column="2" VerticalAlignment="Top" HorizontalAlignment="Center"/>
		<TextBlock x:Name="LblNumUnMask" TextWrapping="Wrap" FontWeight="Bold" Foreground="#FF0F7A01" FontSize="12" Margin="0,0,0,10" Grid.ColumnSpan="2" Grid.Column="2" VerticalAlignment="Bottom" />
		<TextBlock x:Name="LblTextUnMask" TextWrapping="Wrap" Foreground="#FF0F7A01" FontWeight="Bold" FontSize="12" Margin="0,0,0,10" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="1" Grid.Column="2"/>
		<TextBlock x:Name="LblCusUnMask" TextWrapping="Wrap" Foreground="#FF0F7A01" FontWeight="Bold" FontSize="12" Margin="0,0,0,10" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="2" Grid.Column="2"/>
		<TextBlock x:Name="LblPrdUnMask" TextWrapping="Wrap" Foreground="#FF0F7A01" FontWeight="Bold" FontSize="12" Margin="0,0,0,10" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="3" Grid.Column="2"/>
		<TextBlock x:Name="LblUcaseUnMask" TextWrapping="Wrap" Foreground="#FF0F7A01" FontWeight="Bold" FontSize="12" Margin="0,0,0,10" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="4" Grid.Column="2"/>
		<TextBlock x:Name="LblCurrUnMask" Foreground="#FF0F7A01" FontSize="12" FontWeight="Bold" TextWrapping="Wrap" Margin="0,0,0,10" VerticalAlignment="Bottom" Grid.ColumnSpan="2" Grid.Row="5" Grid.Column="2"/>
        <StackPanel Orientation="Vertical" Margin="5,0,0,10">
			<TextBlock Margin="0,0,-15,0" Text="Number Mask = &quot;99999999&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Text="Enter a number" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskNum" Margin="0" TextWrapping="Wrap" Mask="99999999" FontSize="12" LostFocus="MaskNum_LostFocus"  Background="#FFECE8E8"/>
		</StackPanel>
		<StackPanel Orientation="Vertical" Margin="5,0,0,10" Grid.Row="1">
			<TextBlock Text="Text Mask = &quot;R{A}(20)&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Margin="0">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Text="Enter a Text (A-Z)" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskText" TextWrapping="Wrap" Mask="R{A}(20)" FontSize="12" LostFocus="MaskText_LostFocus" Background="#FFECE8E8" Margin="0"/>
		</StackPanel>
		<StackPanel Orientation="Vertical" Margin="5,0,0,10" Grid.Row="2">
			<TextBlock Text="Custom Mask = &quot;R{C}(10)&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" VerticalAlignment="Top" Margin="0">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Text="Enter a only Text  equal : ABCDE" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskCus" Margin="0" TextWrapping="Wrap" Mask="R{C}(10)" FontSize="12" FilterText="ABCDEabcde" LostFocus="MaskCus_LostFocus" Background="#FFECE8E8"/>
		</StackPanel>
		<StackPanel Orientation="Vertical" Margin="5,0,0,10" Grid.Row="3">
			<TextBlock Text="Custom Mask = &quot;C99999&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" VerticalAlignment="Top" Margin="0,0,-15,0">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Text="Enter a Code Product (A|B + code)" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskPrd" Margin="0" TextWrapping="Wrap" Mask="C99999" FontSize="12" FilterText="ABab" LostFocus="MaskPrd_LostFocus"  Background="#FFECE8E8"/>
		</StackPanel>
		<StackPanel Orientation="Vertical" Margin="5,0,0,10" Grid.Row="4">
			<TextBlock Text="Mask = &quot;R{X}(U20)&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Margin="0">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<TextBlock Text="Enter a Text (Conveter to UCase)" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskUcase" Margin="0" TextWrapping="Wrap" Mask="R{X}(U20)" FontSize="12" FilterText="ABab" LostFocus="MaskUcase_LostFocus"  Background="#FFECE8E8"/>
		</StackPanel>
		<StackPanel Orientation="Vertical" Margin="5,0,0,10" Grid.Row="5">
			<TextBlock Margin="0" Text="Mask = &quot;RightNumber($8.2S)&quot;" TextWrapping="Wrap" FontSize="12" FontWeight="Bold">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
			<StackPanel Orientation="Horizontal">
				<TextBlock x:Name="lblcurrLng" Text="Currency Number" TextWrapping="Wrap" FontSize="12"/>
				<CheckBox x:Name="ChkFixRight" Content="Fixed Right" Margin="5,0,0,0" Checked="ChkFixRight_Checked" Unchecked="ChkFixRight_Unchecked"/>
			</StackPanel>
			<IC:MaskedEdit x:Name="MaskCurr" Margin="0" TextWrapping="Wrap" Mask="RightNumber($8.2S)" FontSize="12" LostFocus="MaskCurr_LostFocus"  Background="#FFECE8E8" NegativeForeground="Red"/>
		</StackPanel>
		<StackPanel Margin="5,0,0,10" Grid.Row="6">
			<TextBlock Margin="0" Text="Mask = &quot;999&quot; and &quot;9999&quot; (TwoWay)" TextWrapping="Wrap" FontSize="12" FontWeight="Bold">
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF1240DE" Offset="0"/>
						<GradientStop Color="#FF0A0B0C" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
			</TextBlock>
            <TextBlock x:Name="lblYear" Text="Enter your Year Birth date" TextWrapping="Wrap" FontSize="12"/>
            <IC:MaskedEdit x:Name="MaskYear" Text="{Binding Path=Year,Mode=TwoWay, Converter={StaticResource MaskEditConv}}" Margin="0" TextWrapping="Wrap" Mask="9999" FontSize="12" Background="#FFECE8E8" />
            <TextBlock x:Name="lblAge" Text="Enter your Age" TextWrapping="Wrap" FontSize="12"/>
			<IC:MaskedEdit x:Name="MaskAge" Text="{Binding Path=Age,Mode=TwoWay, Converter={StaticResource MaskEditConv}}" Margin="0" TextWrapping="Wrap" Mask="LeftNumber(S3.0)" FontSize="12"  Background="#FFECE8E8" />
		</StackPanel>
		<StackPanel Orientation="Vertical" Grid.Row="7" Grid.ColumnSpan="3">
			<controls:TabControl x:Name="TabCode" Height="230" Margin="0,0,0,5">
				<controls:TabItem Header="Xaml Code" Foreground="#FF050505">
					<Grid>
						<ScrollViewer x:Name="ScrllXaml" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
							<TextBox x:Name="LblXaml" TextWrapping="NoWrap"  FontSize="12" FontWeight="Bold" IsReadOnly="True" AcceptsReturn="True" />
						</ScrollViewer>
					</Grid>
				</controls:TabItem>
				<controls:TabItem Header="C# Code" Foreground="#FF050505">
					<Grid>
						<ScrollViewer x:Name="ScrllCode" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
							<TextBox x:Name="LblCode" TextWrapping="NoWrap"  FontSize="12" FontWeight="Bold" IsReadOnly="True" AcceptsReturn="True" />
						</ScrollViewer>
					</Grid>
				</controls:TabItem>
			</controls:TabControl>
			<StackPanel Margin="5,5,0,0" Orientation="Horizontal">
				<Button x:Name="BntSelectAll" Content="Select  Text" Click="BntSelectAll_Click"/>
				<TextBlock Text="Use Ctrl +C to Copy from clipboad" TextWrapping="Wrap" VerticalAlignment="Center" Margin="10,0,0,0" FontWeight="Bold" Foreground="#FF5F5050"/>
			</StackPanel>
		</StackPanel>
	</Grid>
</UserControl>
